package com.tledu.dangjian.controller;

import com.tledu.dangjian.core.constants.CommonConstants;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping
public class CommonController {
    @RequestMapping("/index")
    public String index(HttpSession session, Model model) {
        model.addAttribute("currentUser", session.getAttribute(CommonConstants.LOGIN_USER_SESSION_KEY));
        model.addAttribute("resourceList", session.getAttribute(CommonConstants.LOGIN_RESOURCE_SESSION_KEY));
        return "index";
    }

    @RequestMapping("/401")
    public String unAuth(HttpSession session, Model model) {
        return "401";
    }
}
